<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>自定义函数与调用</title>
</head>

<body>
    <script>
        function getSum(n, m) {
            var sum = 0;
            for (var i = n; i <= m; i++) {
                sum = sum + i;
            }
            return sum;
        }
        console.log('5-10之间的数相加为：' + getSum(5, 10));
        console.log('100-1000之间的数相加为：' + getSum(100, 1000))
    </script>
</body>

</html>